<include file="../header" />

<script type="text/javascript" src="/Template/js/vue.min.js"></script>

<body class="J_scroll_fixed" id="container">
<script type="text/javascript">
    $(function() {
        $("select[name='payment_type']").change(function () {
            if($("select[name='payment_type']").find("option:selected").text() == "月结"){
                $("input[name=minimum_percent]").val("0");
            }
        });

        $("button.btn_submit").click(function() {
            if($("input[name=client_info_code]").val() == ""){
                alert("请填写【客户编号】");
                $("input[name=client_info_code]").focus();
                return false;
            }
            if($("input[name=client_info_name]").val() == ""){
                alert("请填写【客户名称】");
                $("input[name=client_info_name]").focus();
                return false;
            }
            if ($("select[name=payment_type]").val() == 0) {
                alert("请选择【结款类型】");
                $("select[name=payment_type]").focus();
                return false;
            }
            var discount = $("input[name=minimum_percent]").val();
            if(discount > 1 || discount < 0 || discount == ""){
                alert("比率应为0~1内的小数");
                $("input[name=minimum_percent]").focus();
                return false;
            }

            $("button.btn_submit").hide();

        });

    })

</script>

<div class="wrap jj">
    <div class="common-form">
        <form method="post" class="form-horizontal J_ajaxForm" action="{:U('ClientInfo/editPost')}">
            <fieldset>
                <input type="hidden" name="id" value="{$info.client_info_id}" />
                <div class="control-group">
                    <label class="control-label">客户编号：</label>
                    <div class="controls">
                        <input type="text" class="input" name="client_info_code" value="{$info.client_info_code}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">客户名称：</label>
                    <div class="controls">
                        <input type="text" class="input" name="client_info_name" value="{$info.client_info_name}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">地址：</label>
                    <div class="controls">
                        <input type="text" class="input" name="address" value="{$info.address}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">电话：</label>
                    <div class="controls">
                        <input type="text" class="input" name="mobile" value="{$info.mobile}">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">联系人：</label>
                    <div class="controls">
                        <textarea style="height:4rem;" name="contact">{$info.contact}</textarea>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">银行信息：</label>
                    <div class="controls">
                        <textarea style="height:4rem;" name="bank_info">{$info.bank_info}</textarea>
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">结款类型：</label>
                    <div class="controls">
                        <select style="width: 85px" name="payment_type">
                            <option value="{$info.payment_type}">请选择</option>
                            {:getFormDictSelectOption($info['payment_type'],'paymentType','all',0)}
                        </select>
                        &nbsp;&nbsp;比率：
                        <input style="width: 60px" type="text" class="input" name="minimum_percent" value="{$info.minimum_percent}" placeholder="0~1小数">
                    </div>
                </div>
                <div class="control-group">
                    <label class="control-label">备注：</label>
                    <div class="controls">
                        <textarea style="height:4rem;" name="remark">{$info.remark}</textarea>
                    </div>
                </div>
            </fieldset>
            <div class="form-actions">
                <button type="submit" class="btn btn-primary btn_submit">更新</button>
                <a class="btn" href="__URL__">返回</a>
            </div>
        </form>
    </div>
</div>
<script src="__ROOT__/statics/js/common.js"></script>
</body>
</html>